import request from '/@/utils/request';

/**
 * 优惠券
 * @param params 要传的参数值
 * @returns 返回接口数据
 * 优惠券api接口集合
 */
export function useCouponApi() {
	return {
		getCouponList: (data) => {
			return request({
				url: '/product/coupon/admin/page',
				method: 'post',
				data,
			});
		},
		addCoupon: (data) => {
			return request({
				url: '/product/coupon/admin/save',
				method: 'post',
				data,
			});
		},
		getCouponDetail: (params) => {
			return request({
				url: `/product/coupon/admin/detail/${params}`,
				method: 'get',
			});
		},
		UpdateCoupon: (data) => {
			return request({
				url: '/product/coupon/admin/update',
				method: 'post',
				data,
			});
		},
		EndCoupon: (couponId) => {
			return request({
				url: `/product/coupon/admin/finish/${couponId}`,
				method: 'get',
			});
		},
		getSkuListByName: (data) => {
			return request({
				url: '/product/sku-stock/admin/listByName',
				method: 'post',
				data,
			});
		},
	};
}
